package robocup.component.geometry.analysers;

import java.util.LinkedList;

import robocup.component.actionfactories.BasicActionFactory;
import robocup.component.actions.Action;
import robocup.component.actions.DashAction;
import robocup.component.actions.TurnAction;
import robocup.component.geometry.Circle;
import robocup.component.geometry.CircleSegment;
import robocup.component.geometry.LineSegment;
import robocup.component.geometry.StraightLine;
import robocup.component.geometry.Vektor;
import robocup.component.situations.GoalkeeperSituation;
import robocup.component.worldobjects.Player;
import robocup.component.worldobjects.Player.RELATIVE;

/**
 * This class represents the area in that the ball could be catched by the
 * goalie in a given number of cycles
 */
public class ReachableArea {

  private final static DashAction DASH_100             = new DashAction(100);

  private int                     cycles;

  private int                     reactCycles;

  private double                  bodyDir;

  private double                  turn1;

  private double                  turn2;

  private double                  turn3;

  private double                  dash0;

  private double                  dash1;

  private double                  dash2;

  private double                  dash3;

  private double                  dash4;

  private final Vektor            pos                  = Vektor
                                                           .getDummyInstance();

  private double                  reachDist;

  private final Player            p                    = Player
                                                           .getDummyInstance();

  private final Player            dummyPlayer          = Player
                                                           .getDummyInstance();

  private final Vektor            dummyVektor          = Vektor
                                                           .getDummyInstance();

  private final Vektor[]          cornerPointsForward  = Vektor
                                                           .getDummyInstances(7);

  private final Vektor[]          cornerPointsBackward = Vektor
                                                           .getDummyInstances(10);

  LineSegment                     dummyLine            = LineSegment
                                                           .getDummyInstance();

  private final Circle dummyCircle = Circle.getDummyInstance();

  private final CircleSegment dummyCircleSegment= CircleSegment.getDummyInstance();

  private final LineSegment dummyLineSegment= LineSegment.getDummyInstance();

  private final Vektor dummyVektor2= Vektor.getDummyInstance();

  /**
   * An object, that can calculate, if certain positions are reachable in a
   * given amount of time for a given player.
   * 
   * <br>
   * NEW OBJECTS: 25
   * 
   * @param _cycles
   *          number of cycles to reach the point
   * @param _reactCycles
   *          number of cycles until movement begins
   * @param _p
   *          the player who wants to reach something
   * @param _reachDist
   *          distance in that the position can be reached / kicked directly
   */
  public ReachableArea(
      final int _cycles,
      final int _reactCycles,
      final Player _p,
      final double _reachDist) {

    this.dummyPlayer.copy(_p);
    this.dummyPlayer.extrapolate(_cycles);
    this.cycles = _cycles;
    this.reactCycles = _reactCycles;
    this.pos.x = this.dummyPlayer.getPosition().x;
    this.pos.y = this.dummyPlayer.getPosition().y;
    this.bodyDir = this.dummyPlayer.getBodyDir();
    this.turn1 = GoalkeeperSituation.getTurnFromArg(180, _p);
    this.dummyPlayer.copy(_p);
    this.dummyPlayer.extrapolate(1);
    this.turn2 = GoalkeeperSituation.getTurnFromArg(180, this.dummyPlayer)
        + this.turn1;
    this.dummyPlayer.extrapolate(1);
    this.turn3 = GoalkeeperSituation.getTurnFromArg(180, this.dummyPlayer)
        + this.turn2;
    if (this.turn1 > 180) {
      this.turn1 = 181;
    }
    if (this.turn2 > 180) {
      this.turn2 = 181;
    }
    if (this.turn3 > 180) {
      this.turn3 = 181;
    }
    this.dummyPlayer.setSpeed(Vektor.CENTER);
    this.dummyPlayer.setPosition(Vektor.CENTER);
    this.dummyPlayer.setBodyDir(0);
    this.dash0 = 0;
    this.dash1 = 0;
    this.dash2 = 0;
    this.dash3 = 0;
    this.dash4 = 0;
    for (int i = this.cycles - 1 - this.reactCycles; i >= 0; i--) {
      this.dummyPlayer.predictThisAfterAction(ReachableArea.DASH_100);
      if (i == 4) {
        this.dash4 = this.dummyPlayer.getPosition().y;
      }
      if (i == 3) {
        this.dash3 = this.dummyPlayer.getPosition().y;
      }
      if (i == 2) {
        this.dash2 = this.dummyPlayer.getPosition().y;
      }
      if (i == 1) {
        this.dash1 = this.dummyPlayer.getPosition().y;
      }
      if (i == 0) {
        this.dash0 = this.dummyPlayer.getPosition().y;
      }
    }
    this.reachDist = _reachDist;
    this.p.copy(_p);
    createPoints();
  }

  /**
   * 
   * <br>
   * NEW OBJECTS: 25
   * 
   * @param _cycles
   *          number of cycles to reach the ball
   * @param _p
   *          the player who wants to reach something
   * @param _reachDist
   *          distance in that the ball can be catched / kicked directly
   */
  public ReachableArea(
      final int _cycles,
      final Player _p,
      final double _reachDist) {

    this.dummyPlayer.copy(_p);
    this.dummyPlayer.extrapolate(_cycles);
    this.cycles = _cycles;
    this.reactCycles = 0;
    this.pos.x = this.dummyPlayer.getPosition().x;
    this.pos.y = this.dummyPlayer.getPosition().y;
    this.bodyDir = this.dummyPlayer.getBodyDir();
    this.turn1 = GoalkeeperSituation.getTurnFromArg(180, _p);
    this.dummyPlayer.copy(_p);
    this.dummyPlayer.extrapolate(1);
    this.turn2 = GoalkeeperSituation.getTurnFromArg(180, this.dummyPlayer)
        + this.turn1;
    this.dummyPlayer.extrapolate(1);
    this.turn3 = GoalkeeperSituation.getTurnFromArg(180, this.dummyPlayer)
        + this.turn2;
    if (this.turn1 > 180) {
      this.turn1 = 181;
    }
    if (this.turn2 > 180) {
      this.turn2 = 181;
    }
    if (this.turn3 > 180) {
      this.turn3 = 181;
    }
    this.dummyPlayer.setSpeed(Vektor.CENTER);
    this.dummyPlayer.setPosition(Vektor.CENTER);
    this.dummyPlayer.setBodyDir(0);
    this.dash0 = 0;
    this.dash1 = 0;
    this.dash2 = 0;
    this.dash3 = 0;
    this.dash4 = 0;
    for (int i = this.cycles - 1 - this.reactCycles; i >= 0; i--) {
      this.dummyPlayer.predictThisAfterAction(ReachableArea.DASH_100);
      if (i == 4) {
        this.dash4 = this.dummyPlayer.getPosition().y;
      }
      if (i == 3) {
        this.dash3 = this.dummyPlayer.getPosition().y;
      }
      if (i == 2) {
        this.dash2 = this.dummyPlayer.getPosition().y;
      }
      if (i == 1) {
        this.dash1 = this.dummyPlayer.getPosition().y;
      }
      if (i == 0) {
        this.dash0 = this.dummyPlayer.getPosition().y;
      }
    }
    this.reachDist = _reachDist;
    this.p.copy(_p);
    createPoints();
  }

  /** 
   * <br>
   * NEW OBJECTS: 25
   * 
   * creates a not initialized ReachableArea
   */
  public ReachableArea() {

    this.reactCycles = 0;
    this.cycles = 0;
    this.pos.x = 0;
    this.pos.y = 0;
    this.bodyDir = 0;
    this.turn1 = 0;
    this.turn2 = 0;
    this.dash0 = 0;
    this.turn3 = 0;
    this.dash4 = 0;
    this.dash1 = 0;
    this.dash2 = 0;
    this.dash3 = 0;
    this.reachDist = 0;
  }

  private void createPoints() {

    for (Vektor vek : cornerPointsForward) {
      vek.setEmpty();
    }
    for (Vektor vek : cornerPointsBackward) {
      vek.setEmpty();
    }
    dummyVektor.setVektor(dash0, bodyDir);
    dummyVektor.addToThis(pos);
    cornerPointsForward[0].copy(dummyVektor);
    if (turn1 < 180) {
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + turn1));
      dummyVektor.addToThis(pos);
      cornerPointsForward[1].copy(dummyVektor);
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir - turn1));
      dummyVektor.addToThis(pos);
      cornerPointsForward[2].copy(dummyVektor);
    }
    if (turn2 < 180) {
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn2));
      dummyVektor.addToThis(pos);
      cornerPointsForward[3].copy(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn2));
      dummyVektor.addToThis(pos);
      cornerPointsForward[4].copy(dummyVektor);
    }
    if (turn3 < 180) {
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn3));
      dummyVektor.addToThis(pos);
      cornerPointsForward[5].copy(dummyVektor);
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn3));
      dummyVektor.addToThis(pos);
      cornerPointsForward[6].copy(dummyVektor);
    }
    dummyVektor.setVektor(dash0, bodyDir);
    dummyVektor.addToThis(pos);
    cornerPointsBackward[0].copy(dummyVektor);
    dummyVektor.setVektor(dash0, Vektor.normalize(bodyDir + 180));
    dummyVektor.addToThis(pos);
    cornerPointsBackward[5].copy(dummyVektor);
    if (turn1 < 90) {
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + turn1));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[1].copy(dummyVektor);
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir - turn1));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[2].copy(dummyVektor);
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + turn1 + 180));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[6].copy(dummyVektor);
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir - turn1 + 180));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[7].copy(dummyVektor);
    }
    if (turn2 < 90) {
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn2));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[3].copy(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn2));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[4].copy(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn2 + 180));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[8].copy(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn2 + 180));
      dummyVektor.addToThis(pos);
      cornerPointsBackward[9].copy(dummyVektor);
    }
  }

  /**
   * @return the cycles
   */
  public int getCycles() {

    return this.cycles;
  }

  /**
   * @return the position (new vektor)
   */
  public Vektor getPos() {

    return pos;
  }

  /**
   * @return the bodydir
   */
  public double getBodyDir() {

    return this.bodyDir;
  }

  /**
   * @return the turn1
   */
  public double getTurn1() {

    return this.turn1;
  }

  /**
   * @return the turn3
   */
  public double getTurn3() {

    return this.turn3;
  }

  /**
   * @return the turn2
   */
  public double getTurn2() {

    return this.turn2;
  }

  /**
   * @return the dash0
   */
  public double getDash0() {

    return this.dash0;
  }

  /**
   * @return the dash4
   */
  public double getDash4() {

    return this.dash4;
  }

  /**
   * @return the dash1
   */
  public double getDash1() {

    return this.dash1;
  }

  /**
   * @return the dash2
   */
  public double getDash2() {

    return this.dash2;
  }

  /**
   * @return the dash3
   */
  public double getDash3() {

    return this.dash3;
  }

  /**
   * @return the reachdist
   */
  public double getReachDist() {

    return this.reachDist;
  }

  /**
   * @return the reactcycles
   */
  public int getReactCycles() {

    return this.reactCycles;
  }

  /**
   * @return a clone of the player
   */
  public Player getPlayer() {

    return this.p;
  }

  /**
   * 
   * @param _cycles
   *          number of cycles to reach the ball
   * @param _reactCycles
   *          number of cycles until movement begins
   * @param _p
   *          the player who wants to reach something
   * @param _reachDist
   *          distance in that the ball can be catched / kicked directly
   */
  public void setArea(final int _cycles,
      final int _reactCycles,
      final Player _p,
      final double _reachDist) {

    this.dummyPlayer.copy(_p);
    this.p.copy(_p);
    this.dummyPlayer.extrapolate(_cycles);
    this.cycles = _cycles;
    this.reactCycles = _reactCycles;
    this.pos.x = this.dummyPlayer.getPosition().x;
    this.pos.y = this.dummyPlayer.getPosition().y;
    this.bodyDir = this.dummyPlayer.getBodyDir();
    this.turn1 = GoalkeeperSituation.getTurnFromArg(180, _p);
    this.dummyPlayer.copy(_p);
    this.dummyPlayer.extrapolate(1);
    this.turn2 = GoalkeeperSituation.getTurnFromArg(180, this.dummyPlayer)
        + this.turn1;
    this.dummyPlayer.extrapolate(1);
    this.turn3 = GoalkeeperSituation.getTurnFromArg(180, this.dummyPlayer)
        + this.turn2;
    if (this.turn1 > 180) {
      this.turn1 = 181;
    }
    if (this.turn2 > 180) {
      this.turn2 = 181;
    }
    if (this.turn3 > 180) {
      this.turn3 = 181;
    }
    this.dummyPlayer.setSpeed(new Vektor(0, 0));
    this.dummyPlayer.setPosition(new Vektor(0, 0));
    this.dummyPlayer.setBodyDir(0);
    this.dash0 = 0;
    this.dash1 = 0;
    this.dash2 = 0;
    this.dash3 = 0;
    this.dash4 = 0;
    for (int i = this.cycles - 1 - this.reactCycles; i >= 0; i--) {
      this.dummyPlayer.predictThisAfterAction(ReachableArea.DASH_100);
      if (i == 4) {
        this.dash4 = this.dummyPlayer.getPosition().y;
      }
      if (i == 3) {
        this.dash3 = this.dummyPlayer.getPosition().y;
      }
      if (i == 2) {
        this.dash2 = this.dummyPlayer.getPosition().y;
      }
      if (i == 1) {
        this.dash1 = this.dummyPlayer.getPosition().y;
      }
      if (i == 0) {
        this.dash0 = this.dummyPlayer.getPosition().y;
      }
    }
    this.reachDist = _reachDist;
    createPoints();
  }

  /**
   * 
   * @param _cycles
   *          number of cycles to reach the ball
   * @param _p
   *          the player who wants to reach something
   * @param _reachDist
   *          distance in that the ball can be catched / kicked directly
   */
  public void setArea(final int _cycles,
      final Player _p,
      final double _reachDist) {

    this.setArea(_cycles, 0, _p, _reachDist);
  }

  /**
   * Copies another ReachableArea into this one
   * 
   * @param ra
   *          the ReachableArea to copy
   */
  public void copy(final ReachableArea ra) {

    this.cycles = ra.getCycles();
    this.reactCycles = ra.getReactCycles();
    this.pos.copy(ra.pos);
    this.bodyDir = ra.getBodyDir();
    this.turn1 = ra.getTurn1();
    this.turn2 = ra.getTurn2();
    this.dash0 = ra.getDash0();
    this.turn3 = ra.getTurn3();
    this.dash4 = ra.getDash4();
    this.dash1 = ra.getDash1();
    this.dash2 = ra.getDash2();
    this.dash3 = ra.getDash3();
    this.reachDist = ra.getReachDist();
    this.p.copy(ra.p);
    for (int i = 0; i < 10; i++) {
      if (i < 7) {
        cornerPointsForward[i].copy(ra.cornerPointsForward[i]);
      }
      cornerPointsBackward[i].copy(ra.cornerPointsBackward[i]);
    }
  }

  /**
   * 
   * @param toReach
   *          position to test
   * @return true if the given position is reachable by turns and forward
   *         dashing
   */
  public boolean inArea(final Vektor toReach) {

    return this.inArea(toReach, false);
  }

  /**
   * 
   * @param toReach
   *          position to test
   * @param back
   *          if true, the player can go backwards too
   * @return true if the point is reachable
   */
  public boolean inArea(final Vektor toReach,
      final boolean back) {

    final double dist = this.pos.getDistance(toReach);
    this.dummyPlayer.setPosition(Vektor.CENTER);
    this.dummyPlayer.setSpeed(Vektor.CENTER);
    this.dummyPlayer.setBodyDir(0);
    double angle = Vektor
        .normalize(this.pos.getAngleTo(toReach) - this.bodyDir);
    if (dist < this.dash4 + this.reachDist) {
      return true;
    }
    if (dist >= this.dash0 + this.reachDist) {
      return false;
    }
    if (Math.abs(angle) <= this.turn3 && dist <= this.dash3 + reachDist) {
      return true;
    }
    if (Math.abs(angle) <= this.turn2 && dist <= this.dash2 + reachDist) {
      return true;
    }
    if (Math.abs(angle) <= this.turn1 && dist <= this.dash1 + reachDist) {
      return true;
    }
    if (!back) {
      dummyVektor.setVektor(dash0, Vektor.normalize(bodyDir));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      if (turn1 < 180) {
        dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + turn1));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint1(dummyVektor);
        dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn1));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint2(dummyVektor);
        dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
        if (dummyVektor.getDistance(toReach) <= reachDist) {
          return true;
        }
        dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir - turn1));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint1(dummyVektor);
        dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn1));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint2(dummyVektor);
        dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
        if (dummyVektor.getDistance(toReach) <= reachDist) {
          return true;
        }
      }
      if (turn2 < 180) {
        dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn2));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint1(dummyVektor);
        dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn2));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint2(dummyVektor);
        dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
        if (dummyVektor.getDistance(toReach) <= reachDist) {
          return true;
        }
        dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn2));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint1(dummyVektor);
        dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn2));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint2(dummyVektor);
        dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
        if (dummyVektor.getDistance(toReach) <= reachDist) {
          return true;
        }
      }
      if (turn3 < 180) {
        dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn3));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint1(dummyVektor);
        dummyVektor.setVektor(dash4, Vektor.normalize(bodyDir + turn3));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint2(dummyVektor);
        dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
        if (dummyVektor.getDistance(toReach) <= reachDist) {
          return true;
        }
        dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn3));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint1(dummyVektor);
        dummyVektor.setVektor(dash4, Vektor.normalize(bodyDir - turn3));
        dummyVektor.addToThis(pos);
        dummyLine.copyPoint2(dummyVektor);
        dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
        if (dummyVektor.getDistance(toReach) <= reachDist) {
          return true;
        }
      }
      for (Vektor corner : cornerPointsForward) {
        if (corner.getDistance(toReach) <= reachDist) {
          return true;
        }
      }
      return false;
    }

    // backwards allowed
    angle = Vektor.normalize(angle + 180);

    if (Math.abs(angle) <= this.turn3 && dist <= this.dash3 + reachDist) {
      return true;
    }
    if (Math.abs(angle) <= this.turn2 && dist <= this.dash2 + reachDist) {
      return true;
    }
    if (Math.abs(angle) <= this.turn1 && dist <= this.dash1 + reachDist) {
      return true;
    }
    dummyVektor.setVektor(dash0, Vektor.normalize(bodyDir));
    dummyVektor.addToThis(pos);
    dummyLine.copyPoint1(dummyVektor);
    dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir));
    dummyVektor.addToThis(pos);
    dummyLine.copyPoint2(dummyVektor);
    dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
    if (dummyVektor.getDistance(toReach) <= reachDist) {
      return true;
    }
    dummyVektor.setVektor(dash0, Vektor.normalize(bodyDir + 180));
    dummyVektor.addToThis(pos);
    dummyLine.copyPoint1(dummyVektor);
    dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + 180));
    dummyVektor.addToThis(pos);
    dummyLine.copyPoint2(dummyVektor);
    dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
    if (dummyVektor.getDistance(toReach) <= reachDist) {
      return true;
    }
    if (turn1 < 90) {
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + turn1));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn1));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir - turn1));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn1));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir + turn1 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn1 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash1, Vektor.normalize(bodyDir - turn1 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn1 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
    }
    if (turn2 < 90) {
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn2 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn2 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn2 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn2 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir + turn2));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn2));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash2, Vektor.normalize(bodyDir - turn2));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn2));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
    }
    if (turn3 < 90) {
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn3));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash4, Vektor.normalize(bodyDir + turn3));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn3));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash4, Vektor.normalize(bodyDir - turn3));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir + turn3 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash4, Vektor.normalize(bodyDir + turn3 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
      dummyVektor.setVektor(dash3, Vektor.normalize(bodyDir - turn3 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint1(dummyVektor);
      dummyVektor.setVektor(dash4, Vektor.normalize(bodyDir - turn3 + 180));
      dummyVektor.addToThis(pos);
      dummyLine.copyPoint2(dummyVektor);
      dummyLine.getClosestPointOnLineSegment(toReach, dummyVektor);
      if (dummyVektor.getDistance(toReach) <= reachDist) {
        return true;
      }
    }
    for (Vektor corner : cornerPointsBackward) {
      if (corner.getDistance(toReach) <= reachDist) {
        return true;
      }
    }
    return false;
  }

  /**
   * 
   * @param pos
   *          the position to reach
   * @param reachedDist
   *          how close I have to come to the target-position
   * @param turnBuffer
   *          if the turnangle is smaller than turnbuffer, no turn is performed
   *          to save time
   * @param backwards
   *          if this is true, then the player checks if it is faster to come
   *          backwards to the desired position otherwise the player runs
   *          definitely forward
   * @param backCycles
   *          gives a maximum number of cycles to dash backward (because of high
   *          stamina costs) if "backwards" is false, this has no effect if
   *          backCycles is smaller than 0, it will be ignored
   * @param watchPos
   *          gives a position that should be watchable during all movements and
   *          influences in this way the decision to move backward or not.
   * 
   * sometimes the position is watchable only for a few cycles during the move
   * in this case the pos is watchable during the first moves of the list
   * 
   * if it is null, it will be ignored if "backwards" is false, watchPos will be
   * ignored
   * @param turnToPos
   *          after all movements are done, the player will turn his body to
   *          this position if null, no turn will be performed after the normal
   *          moves
   * @return a list of movements to reach the given position as fast as possible
   *         under the given conditions
   */
  public LinkedList<Action> getMovesToPos(final Vektor pos,
      final double reachedDist,
      final double turnBuffer,
      boolean backwards,
      int backCycles,
      Vektor watchPos,
      final Vektor turnToPos) {

    // this.debugMovesOut("start calculating moves");
    final LinkedList<Action> list = new LinkedList<Action>();
    if (!backwards) {
      // this.debugMovesOut("FORWARD DEFINITELY");
      backCycles = 0;
      watchPos = null;
    }
    double backDist = 0;
    if (backCycles < 0) {
      // this.debugMovesOut("no backcycles");
      backDist = 100;
    }
    else {
      this.dummyPlayer.setPosition(Vektor.CENTER);
      this.dummyPlayer.setSpeed(Vektor.CENTER);
      this.dummyPlayer.setBodyDir(0);
      for (int i = 0; i < backCycles; i++) {
        this.dummyPlayer.predictThisAfterAction(ReachableArea.DASH_100);
      }
      backDist = this.dummyPlayer.getPosition().y;
    }
    // find extrapolated position
    this.dummyPlayer.copy(this.p);
    this.dummyPlayer.extrapolate(this.cycles);
    this.dummyVektor.copy(this.dummyPlayer.getPosition());
    final double dist2pos = this.dummyVektor.getDistance(pos);
    double angle2pos = Vektor.normalize(this.dummyVektor.getAngleTo(pos)
        - this.bodyDir);
    double angle2watchPos = 0;
    if (watchPos != null) {
      // this.debugMovesOut("using watchpos");
      angle2watchPos = Vektor.normalize(this.dummyVektor.getAngleTo(watchPos)
          - this.bodyDir);
    }
    if (backDist < dist2pos) {
      // this.debugMovesOut("not backwards because of backcycles");
      backwards = false;
    }
    if (watchPos != null) {
      if (Math.abs(Vektor.normalize(angle2watchPos - angle2pos)) < 90) {
        // this.debugMovesOut("not backwards because of watchposition");
        backwards = false;
      }
    }
    else {
      // no watchpos
      if (Math.abs(angle2pos) <= this.turn1) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
      else if (Math.abs(angle2pos) <= this.turn2
          && Math.abs(Vektor.normalize(angle2pos + 180)) > this.turn1) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
      else if (Math.abs(angle2pos) <= this.turn3
          && Math.abs(Vektor.normalize(angle2pos + 180)) > this.turn2) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
      else if (Math.abs(Vektor.normalize(angle2pos + 180)) > this.turn3) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
    }
    this.dummyPlayer.copy(this.p);
    // this.debugMovesOut("backwards: "+backwards);
    // no we know if to dash backward or not
    // this.debugMovesOut("already reached pos: "+(dist2pos <=
    // reachedDist));
    if (dist2pos > reachedDist) {
      if (!backwards) {
        // begin forward
        if (Math.abs(angle2pos) <= this.turn1) {
          // start 1 turn
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t1 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
          }
          // end 1 turn
        }
        else if (Math.abs(angle2pos) <= this.turn2) {
          // start 2 turns
          if (angle2pos > 0) {
            // this.debugMovesOut("turn: 180");
            final TurnAction t1 = new TurnAction(180);
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
            angle2pos -= this.turn1;
          }
          else {
            // this.debugMovesOut("turn: -180");
            final TurnAction t1 = new TurnAction(-180);
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
            angle2pos += this.turn1;
          }
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t2 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t2);
            this.dummyPlayer.predictThisAfterAction(t2);
          }
          // end 2 turns
        }
        else if (Math.abs(angle2pos) <= this.turn3) {
          // start 3 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
            // this.debugMovesOut("turn: 180");
            final TurnAction t2 = new TurnAction(180);
            list.add(t2);
            this.dummyPlayer.predictThisAfterAction(t2);
            // this.debugMovesOut("turn: 180");
            angle2pos -= this.turn2;
          }
          else {
            final TurnAction t1 = new TurnAction(-180);
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
            // this.debugMovesOut("turn: -180");
            final TurnAction t2 = new TurnAction(-180);
            list.add(t2);
            this.dummyPlayer.predictThisAfterAction(t2);
            // this.debugMovesOut("turn: -180");
            angle2pos += this.turn2;
          }
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t3 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t3);
            this.dummyPlayer.predictThisAfterAction(t3);
          }
          // end 3 turns
        }
        else {
          // start 4 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
            // this.debugMovesOut("turn: 180");
            final TurnAction t2 = new TurnAction(180);
            list.add(t2);
            this.dummyPlayer.predictThisAfterAction(t2);
            // this.debugMovesOut("turn: 180");
            final TurnAction t3 = new TurnAction(180);
            list.add(t3);
            this.dummyPlayer.predictThisAfterAction(t3);
            // //this.debugMovesOut("turn: 180");
            angle2pos -= this.turn3;
          }
          else {
            final TurnAction t1 = new TurnAction(-180);
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
            // this.debugMovesOut("turn: -180");
            final TurnAction t2 = new TurnAction(-180);
            list.add(t2);
            this.dummyPlayer.predictThisAfterAction(t2);
            // this.debugMovesOut("turn: -180");
            final TurnAction t3 = new TurnAction(-180);
            list.add(t3);
            this.dummyPlayer.predictThisAfterAction(t3);
            // this.debugMovesOut("turn: -180");
            angle2pos += this.turn3;
          }
          if (Math.abs(angle2pos) > turnBuffer) {
            final TurnAction t4 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            list.add(t4);
            this.dummyPlayer.predictThisAfterAction(t4);
          }
          // end 4 turns
        }
        // begin dashes
        boolean reached = false;
        double actspeed = 0;
        final double decay = this.dummyPlayer.getPConf().PLAYER_DECAY;
        final double dpr = this.dummyPlayer.getPConf().DASH_POWER_RATE;
        double decaydist = 0;
        double actdist = 0;
        double newdist = 0;
        while (!reached) {
          actspeed = this.dummyPlayer.getSpeed().getLength();
          decaydist = actspeed
              + (decay * actspeed)
              + (decay * decay * actspeed);
          actdist = this.dummyPlayer.getDistance(pos);
          if (actdist > decaydist + reachedDist) {
            final DashAction d = new DashAction(100);
            list.add(d);
            // this.debugMovesOut("dash: 100");
            this.dummyPlayer.predictThisAfterAction(d);
            newdist = this.dummyPlayer.getDistance(pos);
            if (newdist > actdist) {
              reached = true;
            }
          }
          else {
            int dashpower = (int) Math.round((actdist - decaydist)
                / ((1 + decay + decay * decay) * dpr));
            dashpower = Math.max(-100, Math.min(100, dashpower));
            // this.debugMovesOut("dash: "+dashpower);
            final DashAction d = new DashAction(dashpower);
            list.add(d);
            this.dummyPlayer.predictThisAfterAction(d);
            reached = true;
          }
        }
        // end forward
      }
      else {
        // begin backward
        angle2pos = Vektor.normalize(angle2pos + 180);
        if (Math.abs(angle2pos) <= this.turn1) {
          // start 1 turn
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t1 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t1);
            this.dummyPlayer.predictThisAfterAction(t1);
          }
          // end 1 turn
        }
        else if (Math.abs(angle2pos) <= this.turn2) {
          // start 2 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            list.add(t1);
            // this.debugMovesOut("turn: 180");
            this.dummyPlayer.predictThisAfterAction(t1);
            angle2pos -= this.turn1;
          }
          else {
            final TurnAction t1 = new TurnAction(-180);
            list.add(t1);
            // this.debugMovesOut("turn: -180");
            this.dummyPlayer.predictThisAfterAction(t1);
            angle2pos += this.turn1;
          }
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t2 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t2);
            this.dummyPlayer.predictThisAfterAction(t2);
          }
          // end 2 turns
        }
        else if (Math.abs(angle2pos) <= this.turn3) {
          // start 3 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            list.add(t1);
            // this.debugMovesOut("turn: 180");
            this.dummyPlayer.predictThisAfterAction(t1);
            final TurnAction t2 = new TurnAction(180);
            list.add(t2);
            // this.debugMovesOut("turn: 180");
            this.dummyPlayer.predictThisAfterAction(t2);
            angle2pos -= this.turn2;
          }
          else {
            final TurnAction t1 = new TurnAction(-180);
            list.add(t1);
            // this.debugMovesOut("turn: -180");
            this.dummyPlayer.predictThisAfterAction(t1);
            final TurnAction t2 = new TurnAction(-180);
            list.add(t2);
            // this.debugMovesOut("turn: -180");
            this.dummyPlayer.predictThisAfterAction(t2);
            angle2pos += this.turn2;
          }
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t3 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t3);
            this.dummyPlayer.predictThisAfterAction(t3);
          }
          // end 3 turns
        }
        else {
          // start 4 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            list.add(t1);
            // this.debugMovesOut("turn: 180");
            this.dummyPlayer.predictThisAfterAction(t1);
            final TurnAction t2 = new TurnAction(180);
            list.add(t2);
            // this.debugMovesOut("turn: 180");
            this.dummyPlayer.predictThisAfterAction(t2);
            final TurnAction t3 = new TurnAction(180);
            list.add(t3);
            // this.debugMovesOut("turn: 180");
            this.dummyPlayer.predictThisAfterAction(t3);
            angle2pos -= this.turn3;
          }
          else {
            final TurnAction t1 = new TurnAction(-180);
            list.add(t1);
            // this.debugMovesOut("turn: -180");
            this.dummyPlayer.predictThisAfterAction(t1);
            final TurnAction t2 = new TurnAction(-180);
            list.add(t2);
            // this.debugMovesOut("turn: -180");
            this.dummyPlayer.predictThisAfterAction(t2);
            final TurnAction t3 = new TurnAction(-180);
            list.add(t3);
            // this.debugMovesOut("turn: -180");
            this.dummyPlayer.predictThisAfterAction(t3);
            angle2pos += this.turn3;
          }
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t4 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            list.add(t4);
            this.dummyPlayer.predictThisAfterAction(t4);
          }
          // end 4 turns
        }
        // begin dashes
        boolean reached = false;
        double actspeed = 0;
        final double decay = this.dummyPlayer.getPConf().PLAYER_DECAY;
        final double dpr = this.dummyPlayer.getPConf().DASH_POWER_RATE;
        double decaydist = 0;
        double actdist = 0;
        double newdist = 0;
        while (!reached) {
          actspeed = this.dummyPlayer.getSpeed().getLength();
          decaydist = actspeed
              + (decay * actspeed)
              + (decay * decay * actspeed);
          actdist = this.dummyPlayer.getDistance(pos);
          if (actdist > decaydist + reachedDist) {
            // this.debugMovesOut("big dist");
            final DashAction d = new DashAction(-100);
            list.add(d);
            // this.debugMovesOut("dash: -100");
            this.dummyPlayer.predictThisAfterAction(d);
            newdist = this.dummyPlayer.getDistance(pos);
            if (newdist > actdist) {
              reached = true;
            }
          }
          else {
            // this.debugMovesOut("last dash");
            int dashpower = -(int) Math.round((actdist - decaydist)
                / ((1 + decay + decay * decay) * dpr));
            dashpower = Math.max(-100, Math.min(100, dashpower));
            // this.debugMovesOut("dash: "+dashpower);
            final DashAction d = new DashAction(dashpower);
            list.add(d);
            this.dummyPlayer.predictThisAfterAction(d);
            reached = true;
          }
        }
        // end backward
      }
      // end not in reached dist
    }
    // this.debugMovesOut("turn to desired pos");
    // turn to desired pos
    if (turnToPos != null) {
      angle2pos = Vektor.normalize(this.dummyPlayer.getAngleTo(turnToPos)
          - this.bodyDir);
      if (Math.abs(angle2pos) <= this.turn1) {
        // start 1 turn
        if (Math.abs(angle2pos) > turnBuffer) {
          // this.debugMovesOut("turn: "+getTurnArg(angle2pos, p));
          final TurnAction t1 = new TurnAction(GoalkeeperSituation.getTurnArg(
              angle2pos, this.p));
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
        }
        // end 1 turn
      }
      else if (Math.abs(angle2pos) <= this.turn2) {
        // start 2 turns
        if (angle2pos > 0) {
          // this.debugMovesOut("turn: 180");
          final TurnAction t1 = new TurnAction(180);
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
          angle2pos -= this.turn1;
        }
        else {
          // this.debugMovesOut("turn: -180");
          final TurnAction t1 = new TurnAction(-180);
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
          angle2pos += this.turn1;
        }
        if (Math.abs(angle2pos) > turnBuffer) {
          // this.debugMovesOut("turn: "+getTurnArg(angle2pos, p));
          final TurnAction t2 = new TurnAction(GoalkeeperSituation.getTurnArg(
              angle2pos, this.p));
          list.add(t2);
          this.dummyPlayer.predictThisAfterAction(t2);
        }
        // end 2 turns
      }
      else if (Math.abs(angle2pos) <= this.turn3) {
        // start 3 turns
        if (angle2pos > 0) {
          // this.debugMovesOut("turn: 180");
          final TurnAction t1 = new TurnAction(180);
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
          // this.debugMovesOut("turn: 180");
          final TurnAction t2 = new TurnAction(180);
          list.add(t2);
          this.dummyPlayer.predictThisAfterAction(t2);
          angle2pos -= this.turn2;
        }
        else {
          // this.debugMovesOut("turn: -180");
          final TurnAction t1 = new TurnAction(-180);
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
          // this.debugMovesOut("turn: -180");
          final TurnAction t2 = new TurnAction(-180);
          list.add(t2);
          this.dummyPlayer.predictThisAfterAction(t2);
          angle2pos += this.turn2;
        }
        if (Math.abs(angle2pos) > turnBuffer) {
          // this.debugMovesOut("turn: "+getTurnArg(angle2pos, p));
          final TurnAction t3 = new TurnAction(GoalkeeperSituation.getTurnArg(
              angle2pos, this.p));
          list.add(t3);
          this.dummyPlayer.predictThisAfterAction(t3);
        }
        // end 3 turns
      }
      else {
        // start 4 turns
        if (angle2pos > 0) {
          // this.debugMovesOut("turn: 180");
          final TurnAction t1 = new TurnAction(180);
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
          // this.debugMovesOut("turn: 180");
          final TurnAction t2 = new TurnAction(180);
          list.add(t2);
          this.dummyPlayer.predictThisAfterAction(t2);
          // this.debugMovesOut("turn: 180");
          final TurnAction t3 = new TurnAction(180);
          list.add(t3);
          this.dummyPlayer.predictThisAfterAction(t3);
          angle2pos -= this.turn3;
        }
        else {
          // this.debugMovesOut("turn: -180");
          final TurnAction t1 = new TurnAction(-180);
          list.add(t1);
          this.dummyPlayer.predictThisAfterAction(t1);
          // this.debugMovesOut("turn: -180");
          final TurnAction t2 = new TurnAction(-180);
          list.add(t2);
          this.dummyPlayer.predictThisAfterAction(t2);
          // this.debugMovesOut("turn: -180");
          final TurnAction t3 = new TurnAction(-180);
          list.add(t3);
          this.dummyPlayer.predictThisAfterAction(t3);
          angle2pos += this.turn3;
        }
        if (Math.abs(angle2pos) > turnBuffer) {
          // this.debugMovesOut("turn: "+getTurnArg(angle2pos, p));
          final TurnAction t4 = new TurnAction(GoalkeeperSituation.getTurnArg(
              angle2pos, this.p));
          list.add(t4);
          this.dummyPlayer.predictThisAfterAction(t4);
        }
        // end 4 turns
      }
    }
    if (list.size() == 0) {
      final TurnAction t = new TurnAction(0);
      // this.debugMovesOut("no action, add turn 0");
      list.add(t);
    }
    return list;
  }

  /**
   * 
   * @param pos
   *          the position to reach
   * @param reachedDist
   *          how close I have to come to the target-position
   * @param turnBuffer
   *          if the turnangle is smaller than turnbuffer, no turn is performed
   *          to save time
   * @param backwards
   *          if this is true, then the player checks if it is faster to come
   *          backwards to the desired position otherwise the player runs
   *          definitely forward
   * @param backCycles
   *          gives a maximum number of cycles to dash backward (because of high
   *          stamina costs) if "backwards" is false, this has no effect if
   *          backCycles is smaller than 0, it will be ignored
   * @param watchPos
   *          gives a position that should be watchable during all movements and
   *          influences in this way the decision to move backward or not.
   * 
   * sometimes the position is watchable only for a few cycles during the move
   * in this case the pos is watchable during the first moves of the list
   * 
   * if it is null, it will be ignored if "backwards" is false, watchPos will be
   * ignored
   * @param turnToPos
   *          after all movements are done, the player will turn his body to
   *          this position if null, no turn will be performed after the normal
   *          moves
   * @return a list of movements to reach the given position as fast as possible
   *         under the given conditions
   */
  public Action getFirstMoveToPos(final Vektor pos,
      final double reachedDist,
      final double turnBuffer,
      boolean backwards,
      int backCycles,
      Vektor watchPos,
      final Vektor turnToPos) {

    // this.debugMovesOut("start calculating moves");
    // LinkedList<Action> list= new LinkedList<Action>();
    if (!backwards) {
      // this.debugMovesOut("FORWARD DEFINITELY");
      backCycles = 0;
      watchPos = null;
    }
    double backDist = 0;
    if (backCycles < 0) {
      // this.debugMovesOut("no backcycles");
      backDist = 100;
    }
    else {
      this.dummyPlayer.setPosition(new Vektor(0, 0));
      this.dummyPlayer.setSpeed(new Vektor(0, 0));
      this.dummyPlayer.setBodyDir(0);
      for (int i = 0; i < backCycles; i++) {
        this.dummyPlayer.predictThisAfterAction(ReachableArea.DASH_100);
      }
      backDist = this.dummyPlayer.getPosition().y;
    }
    // find extrapolated position
    this.dummyPlayer.copy(this.p);
    this.dummyPlayer.extrapolate(this.cycles);
    this.dummyVektor.copy(this.dummyPlayer.getPosition());
    final double dist2pos = this.dummyVektor.getDistance(pos);
    double angle2pos = this.dummyPlayer.getAngleRel(pos, RELATIVE.TO_BODY);
    double angle2watchPos = 0;
    if (watchPos != null) {
      // this.debugMovesOut("using watchpos");
      angle2watchPos = Vektor.normalize(this.dummyVektor.getAngleTo(watchPos)
          - this.bodyDir);
    }
    if (backDist < dist2pos) {
      // this.debugMovesOut("not backwards because of backcycles");
      backwards = false;
    }
    if (watchPos != null && backwards) {
      if (Math.abs(Vektor.normalize(angle2watchPos - angle2pos)) < 90) {
        // this.debugMovesOut("not backwards because of watchposition");
        backwards = false;
      }
    }
    else {
      // no watchpos
      if (Math.abs(angle2pos) <= this.turn1) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
      else if (Math.abs(angle2pos) <= this.turn2
          && Math.abs(Vektor.normalize(angle2pos + 180)) > this.turn1) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
      else if (Math.abs(angle2pos) <= this.turn3
          && Math.abs(Vektor.normalize(angle2pos + 180)) > this.turn2) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
      else if (Math.abs(Vektor.normalize(angle2pos + 180)) > this.turn3) {
        // this.debugMovesOut("not beackwards because of turnangle");
        backwards = false;
      }
    }
    this.dummyPlayer.copy(this.p);
    // this.debugMovesOut("backwards: "+backwards);
    // no we know if to dash backward or not
    // this.debugMovesOut("already reached pos: "+(dist2pos <=
    // reachedDist));
    if (dist2pos > reachedDist) {
      if (!backwards) {
        if (Math.abs(angle2pos) > this.turn2 && this.p.getStamina() > 2800) {
          return BasicActionFactory.dashToPoint(this.p, this.p.getPosition());
        }
        // begin forward
        if (Math.abs(angle2pos) <= this.turn1) {
          // start 1 turn
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t1 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            return t1;
          }
          // end 1 turn
        }
        else if (Math.abs(angle2pos) <= this.turn2) {
          // start 2 turns
          if (angle2pos > 0) {
            // this.debugMovesOut("turn: 180");
            final TurnAction t1 = new TurnAction(180);
            return t1;
          }
          // this.debugMovesOut("turn: -180");
          final TurnAction t1 = new TurnAction(-180);
          return t1;
        }
        else if (Math.abs(angle2pos) <= this.turn3) {
          // start 3 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            return t1;
          }
          final TurnAction t1 = new TurnAction(-180);
          return t1;
        }
        else {
          // start 4 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            return t1;
          }
          final TurnAction t1 = new TurnAction(-180);
          return t1;
          // end 4 turns
        }
        // begin dashes
        boolean reached = false;
        if (this.dummyPlayer.getPosition().getDistance(pos) < reachedDist) {
          reached = true;
        }
        double actspeed = 0;
        final double decay = this.dummyPlayer.getPConf().PLAYER_DECAY;
        final double dpr = this.dummyPlayer.getPConf().DASH_POWER_RATE;
        double decaydist = 0;
        double actdist = 0;
        while (!reached) {
          actspeed = this.dummyPlayer.getSpeed().getLength();
          decaydist = actspeed
              + (decay * actspeed)
              + (decay * decay * actspeed);
          actdist = this.dummyPlayer.getDistance(pos);
          if (actdist > decaydist + reachedDist) {
            final DashAction d = new DashAction(100);
            return d;
          }
          int dashpower = (int) Math.round((actdist - decaydist)
              / ((1 + decay + decay * decay) * dpr));
          dashpower = Math.max(-100, Math.min(100, dashpower));
          // this.debugMovesOut("dash: "+dashpower);
          final DashAction d = new DashAction(dashpower);
          return d;
        }
        // end forward
      }
      else {
        // begin backward
        angle2pos = Vektor.normalize(angle2pos + 180);
        if (Math.abs(angle2pos) <= this.turn1) {
          // start 1 turn
          if (Math.abs(angle2pos) > turnBuffer) {
            // this.debugMovesOut("turn: "+getTurnArg(angle2pos,
            // p));
            final TurnAction t1 = new TurnAction(GoalkeeperSituation
                .getTurnArg(angle2pos, this.p));
            return t1;
          }
          // end 1 turn
        }
        else if (Math.abs(angle2pos) <= this.turn2) {
          // start 2 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            return t1;
          }
          final TurnAction t1 = new TurnAction(-180);
          return t1;
        }
        else if (Math.abs(angle2pos) <= this.turn3) {
          // start 3 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            return t1;
          }
          final TurnAction t1 = new TurnAction(-180);
          return t1;
        }
        else {
          // start 4 turns
          if (angle2pos > 0) {
            final TurnAction t1 = new TurnAction(180);
            return t1;
          }
          final TurnAction t1 = new TurnAction(-180);
          return t1;
        }
        // begin dashes
        boolean reached = false;
        if (this.dummyPlayer.getPosition().getDistance(pos) < reachedDist) {
          reached = true;
        }
        double actspeed = 0;
        final double decay = this.dummyPlayer.getPConf().PLAYER_DECAY;
        final double dpr = this.dummyPlayer.getPConf().DASH_POWER_RATE;
        double decaydist = 0;
        double actdist = 0;
        while (!reached) {
          actspeed = this.dummyPlayer.getSpeed().getLength();
          decaydist = actspeed
              + (decay * actspeed)
              + (decay * decay * actspeed);
          actdist = this.dummyPlayer.getDistance(pos);
          if (actdist > decaydist + reachedDist) {
            // this.debugMovesOut("big dist");
            final DashAction d = new DashAction(-100);
            return d;
          }
          // this.debugMovesOut("last dash");
          int dashpower = -(int) Math.round((actdist - decaydist)
              / ((1 + decay + decay * decay) * dpr));
          dashpower = Math.max(-100, Math.min(100, dashpower));
          // this.debugMovesOut("dash: "+dashpower);
          final DashAction d = new DashAction(dashpower);
          return d;
        }
        // end backward
      }
      // end not in reached dist
    }
    // this.debugMovesOut("turn to desired pos");
    // turn to desired pos
    if (turnToPos != null) {
      angle2pos = Vektor.normalize(this.dummyPlayer.getAngleTo(turnToPos)
          - this.bodyDir);
      if (Math.abs(angle2pos) <= this.turn1) {
        // start 1 turn
        if (Math.abs(angle2pos) > turnBuffer) {
          // this.debugMovesOut("turn: "+getTurnArg(angle2pos, p));
          final TurnAction t1 = new TurnAction(GoalkeeperSituation.getTurnArg(
              angle2pos, this.p));
          return t1;
        }
        // end 1 turn
      }
      else if (Math.abs(angle2pos) <= this.turn2) {
        // start 2 turns
        if (angle2pos > 0) {
          // this.debugMovesOut("turn: 180");
          final TurnAction t1 = new TurnAction(180);
          return t1;
        }
        // this.debugMovesOut("turn: -180");
        final TurnAction t1 = new TurnAction(-180);
        return t1;
      }
      else if (Math.abs(angle2pos) <= this.turn3) {
        // start 3 turns
        if (angle2pos > 0) {
          // this.debugMovesOut("turn: 180");
          final TurnAction t1 = new TurnAction(180);
          return t1;
        }
        // this.debugMovesOut("turn: -180");
        final TurnAction t1 = new TurnAction(-180);
        return t1;
      }
      else {
        // start 4 turns
        if (angle2pos > 0) {
          // this.debugMovesOut("turn: 180");
          final TurnAction t1 = new TurnAction(180);
          return t1;
        }
        // this.debugMovesOut("turn: -180");
        final TurnAction t1 = new TurnAction(-180);
        return t1;
      }
    }
    final TurnAction t = new TurnAction(0);
    // this.debugMovesOut("no action, add turn 0");
    return t;
  }

  /**
   * 
   * @param pos
   *          the position to reach a list of movements to reach the given
   *          position as fast as possible under the given conditions
   * @return the list of actions to reach a point
   */
  public LinkedList<Action> getMovesToPos(final Vektor pos) {

    return this.getMovesToPos(pos, 1, 3, false, -1, null, null);
  }

  /**
   * 
   * @param pos
   *          the position to reach
   * @param backwards
   *          if this is true, then the player checks if it is faster to come
   *          backwards to the desired position otherwise the player runs
   *          definitely forward
   * @param watchPos
   *          gives a position that should be watchable during all movements and
   *          influences in this way the decision to move backward or not.
   * 
   * sometimes the position is watchable only for a few cycles during the move
   * in this case the pos is watchable during the first moves of the list
   * 
   * if it is null, it will be ignored if "backwards" is false, watchPos will be
   * ignored
   * @param turnToPos
   *          after all movements are done, the player will turn his body to
   *          this position if null, no turn will be performed after the normal
   *          moves
   * @return a list of movements to reach the given position as fast as possible
   *         under the given conditions
   */
  public LinkedList<Action> getMovesToPos(final Vektor pos,
      final boolean backwards,
      final Vektor watchPos,
      final Vektor turnToPos) {

    return this.getMovesToPos(pos, 1, 3, backwards, -1, watchPos, turnToPos);
  }

  /**
   * 
   * @param pos
   *          the position to reach
   * @param backwards
   *          if this is true, then the player checks if it is faster to come
   *          backwards to the desired position otherwise the player runs
   *          definitely forward
   * @param turnToPos
   *          after all movements are done, the player will turn his body to
   *          this position if null, no turn will be performed after the normal
   *          moves
   * @return a list of movements to reach the given position as fast as possible
   *         under the given conditions
   */
  public LinkedList<Action> getMovesToPos(final Vektor pos,
      final boolean backwards,
      final Vektor turnToPos) {

    return this.getMovesToPos(pos, 1, 3, backwards, -1, null, turnToPos);
  }

  /**
   * @return The outer corners of the RA when backwards moving is allowed. Some
   *         points may be empty.
   */
  public Vektor[] getCornerPointsBackward() {

    return cornerPointsBackward;
  }

  /**
   * @return The outer corners of the RA when backwards moving is forbidden.
   *         Some points may be empty.
   */
  public Vektor[] getCornerPointsForward() {

    return cornerPointsForward;
  }
  
  /**
   * Calculates the intersection points of this RA and a Circle and add the results to the given list.
   * 
   * @param c the Circle to intersect with
   * @param back if true, backwards movement is allowed
   * @return a list that contains the intersection points
   */
  public final LinkedList<Vektor> getIntersectionPoints(final Circle c, final boolean back) {
    LinkedList<Vektor> res= new LinkedList<Vektor>();
    addIntersectionPointsToList(c, back, res);
    return res;
  }
  
  /**
   * Calculates the intersection points of this RA and a Circle and add the results to the given list.
   * 
   * @param c the Circle to intersect with
   * @param back if true, backwards movement is allowed
   * @param list here the results are added
   */
  public final void addIntersectionPointsToList(final Circle c, final boolean back, final LinkedList<Vektor> list) {
    if (back) {
      addIntersectionPointsBackwardToList(c, list);
      return;
    }
    addIntersectionPointsForwardToList(c, list);
  }

  private void addIntersectionPointsForwardToList(Circle c,
      LinkedList<Vektor> list) {

    if (this.getCycles() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsForward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment
            .setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        if (this.getCycles() == 2) {
          if (this.getTurn1() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn1()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn1()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        if (this.getCycles() == 3) {
          if (this.getTurn2() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn2()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn2()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      if (this.getTurn3() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[5]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn3()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() + this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn3()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() - this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash4() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn3()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn3()));
      dummyCircleSegment.setRadius(this.getDash4() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }

  private void addIntersectionPointsBackwardToList(Circle c,
      LinkedList<Vektor> list) {

    if (this.getDash0() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[5]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor
            .normalize(this.getBodyDir() + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[7]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[7]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[8]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[9]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[8]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[9]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()
          + 180));
      dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()
          + 180));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }
  
  /**
   * Calculates the intersection points of this RA and a CircleSegment and add the results to the given list.
   * 
   * @param c the CircleSegment to intersect with
   * @param back if true, backwards movement is allowed
   * @return a list that contains the intersection points
   */
  public final LinkedList<Vektor> getIntersectionPoints(final CircleSegment c, final boolean back) {
    LinkedList<Vektor> res= new LinkedList<Vektor>();
    addIntersectionPointsToList(c, back, res);
    return res;
  }
  
  /**
   * Calculates the intersection points of this RA and a CircleSegment and add the results to the given list.
   * 
   * @param c the CircleSegment to intersect with
   * @param back if true, backwards movement is allowed
   * @param list here the results are added
   */
  public final void addIntersectionPointsToList(final CircleSegment c, final boolean back, final LinkedList<Vektor> list) {
    if (back) {
      addIntersectionPointsBackwardToList(c, list);
      return;
    }
    addIntersectionPointsForwardToList(c, list);
  }

  private void addIntersectionPointsForwardToList(CircleSegment c,
      LinkedList<Vektor> list) {

    if (this.getCycles() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsForward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment
            .setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        if (this.getCycles() == 2) {
          if (this.getTurn1() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn1()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn1()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        if (this.getCycles() == 3) {
          if (this.getTurn2() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn2()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn2()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      if (this.getTurn3() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[5]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn3()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() + this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn3()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() - this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash4() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn3()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn3()));
      dummyCircleSegment.setRadius(this.getDash4() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }

  private void addIntersectionPointsBackwardToList(CircleSegment c,
      LinkedList<Vektor> list) {

    if (this.getDash0() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[5]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor
            .normalize(this.getBodyDir() + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[7]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[7]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[8]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[9]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[8]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[9]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointsToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()
          + 180));
      dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()
          + 180));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }
  
  /**
   * Calculates the intersection points of this RA and a LineSegment and add the results to the given list.
   * 
   * @param c the LineSegment to intersect with
   * @param back if true, backwards movement is allowed
   * @return a list that contains the intersection points
   */
  public final LinkedList<Vektor> getIntersectionPoints(final LineSegment c, final boolean back) {
    LinkedList<Vektor> res= new LinkedList<Vektor>();
    addIntersectionPointsToList(c, back, res);
    return res;
  }
  
  /**
   * Calculates the intersection points of this RA and a LineSegment and add the results to the given list.
   * 
   * @param c the LineSegment to intersect with
   * @param back if true, backwards movement is allowed
   * @param list here the results are added
   */
  public final void addIntersectionPointsToList(final LineSegment c, final boolean back, final LinkedList<Vektor> list) {
    if (back) {
      addIntersectionPointsBackwardToList(c, list);
      return;
    }
    addIntersectionPointsForwardToList(c, list);
  }

  private void addIntersectionPointsForwardToList(LineSegment c,
      LinkedList<Vektor> list) {

    if (this.getCycles() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsForward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment
            .setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        if (this.getCycles() == 2) {
          if (this.getTurn1() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn1()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn1()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        if (this.getCycles() == 3) {
          if (this.getTurn2() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn2()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn2()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      if (this.getTurn3() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[5]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn3()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() + this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn3()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() - this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash4() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn3()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn3()));
      dummyCircleSegment.setRadius(this.getDash4() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }

  private void addIntersectionPointsBackwardToList(LineSegment c,
      LinkedList<Vektor> list) {

    if (this.getDash0() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[5]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor
            .normalize(this.getBodyDir() + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[7]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[7]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[8]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[9]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[8]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[9]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()
          + 180));
      dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()
          + 180));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }
  
  /**
   * Calculates the intersection points of this RA and a StraightLine and add the results to the given list.
   * 
   * @param c the StraightLine to intersect with
   * @param back if true, backwards movement is allowed
   * @return a list that contains the intersection points
   */
  public final LinkedList<Vektor> getIntersectionPoints(final StraightLine c, final boolean back) {
    LinkedList<Vektor> res= new LinkedList<Vektor>();
    addIntersectionPointsToList(c, back, res);
    return res;
  }
  
  /**
   * Calculates the intersection points of this RA and a StraightLine and add the results to the given list.
   * 
   * @param c the StraightLine to intersect with
   * @param back if true, backwards movement is allowed
   * @param list here the results are added
   */
  public final void addIntersectionPointsToList(final StraightLine c, final boolean back, final LinkedList<Vektor> list) {
    if (back) {
      addIntersectionPointsBackwardToList(c, list);
      return;
    }
    addIntersectionPointsForwardToList(c, list);
  }

  private void addIntersectionPointsForwardToList(StraightLine c,
      LinkedList<Vektor> list) {

    if (this.getCycles() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsForward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment
            .setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getPos());
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        if (this.getCycles() == 2) {
          if (this.getTurn1() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn1()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn1()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        if (this.getCycles() == 3) {
          if (this.getTurn2() < 90) {
            dummyCircleSegment.copyCenter(this.getPos());
            dummyCircleSegment.setRadius(this.getReachDist());
            dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
                + this.getTurn2()
                + 90));
            dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
                - this.getTurn2()
                - 90));
            c.addIntersectionPointsToList(dummyCircleSegment, list);
          }
        }
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      if (this.getTurn3() < 180) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[5]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn3()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsForward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn3()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn3()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() + this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn3()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsForward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash3() - this.getDash4(), Vektor
            .normalize(this.getBodyDir() - this.getTurn3() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash4() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn3()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn3()));
      dummyCircleSegment.setRadius(this.getDash4() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }

  private void addIntersectionPointsBackwardToList(StraightLine c,
      LinkedList<Vektor> list) {

    if (this.getDash0() == 0) {
      dummyCircle.setCenter(this.getPos());
      dummyCircle.setRadius(this.getReachDist());
      c.addIntersectionPointsToList(dummyCircle, list);
      return;
    }
    if (this.getDash0() > 0) {
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[0]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() - 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setRadius(this.getReachDist());
      dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[5]);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir() + 90));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() - 90));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      if (this.getCycles() == 1) {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[0]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir() + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[5]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(Math.max(0, this.getDash0() - this.getDash1()),
            Vektor.normalize(this.getBodyDir()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
    }
    if (this.getDash1() > 0) {
      if (this.getTurn1() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash1() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir() + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor
            .normalize(this.getBodyDir() + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[1]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[2]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[6]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[7]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[1]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[2]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn1()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[6]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() + this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn1()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[7]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash1() - this.getDash2(), Vektor
            .normalize(this.getBodyDir() - this.getTurn1()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyCircle.setCenter(this.getPos());
        dummyCircle.setRadius(this.getDash1() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircle, list);
        return;
      }
    }
    if (this.getDash2() > 0) {
      if (this.getTurn2() < 90) {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[3]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[4]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            - 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setRadius(this.getReachDist());
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[8]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn2()
            - 90));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.copyCenter(this.getCornerPointsBackward()[9]);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 90));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn2()
            + 180));
        c.addIntersectionPointsToList(dummyCircleSegment, list);

        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[3]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[4]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2() + 180));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            + this.getTurn2()
            - 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[8]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() + this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
        dummyVektor.setVektor(this.getReachDist(), Vektor.normalize(this
            .getBodyDir()
            - this.getTurn2()
            + 90));
        dummyVektor.addToThis(this.getCornerPointsBackward()[9]);
        dummyLineSegment.copyPoint1(dummyVektor);
        dummyVektor2.setVektor(this.getDash2() - this.getDash3(), Vektor
            .normalize(this.getBodyDir() - this.getTurn2()));
        dummyVektor.addToThis(dummyVektor2);
        dummyLineSegment.copyPoint2(dummyVektor);
        c.addIntersectionPointToList(dummyLineSegment, list);
      }
      else {
        dummyCircleSegment.copyCenter(this.getPos());
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()
            + 180));
        dummyCircleSegment.setRadius(this.getDash2() + this.getReachDist());
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
            + this.getTurn1()
            + 180));
        dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
            - this.getTurn1()));
        c.addIntersectionPointsToList(dummyCircleSegment, list);
        return;
      }
    }
    if (this.getDash3() > 0) {
      dummyCircleSegment.copyCenter(this.getPos());
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()
          + 180));
      dummyCircleSegment.setRadius(this.getDash3() + this.getReachDist());
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      dummyCircleSegment.setStartAngle(Vektor.normalize(this.getBodyDir()
          + this.getTurn2()
          + 180));
      dummyCircleSegment.setEndAngle(Vektor.normalize(this.getBodyDir()
          - this.getTurn2()));
      c.addIntersectionPointsToList(dummyCircleSegment, list);
      return;
    }

  }
  
  public String toString() {
    StringBuffer sb= new StringBuffer();
    sb.append("pos: ").append(pos).append(" cyc: ").append(cycles).append(" waitCyc: ").append(reactCycles).append(" reach: ").append(reachDist).append(" dash: ").append(dash0).append(" / ").append(dash1).append(" / ").append(dash2).append(" / ").append(dash3).append(" / ").append(dash4).append(" turn: ").append(turn1).append(" / ").append(turn2).append(" / ").append(turn3);
    return sb.toString();
  }
  
}
